//
//  MingxiListTableViewCell.m
//  markmap
//
//  Created by 甘世清 on 2024/6/19.
//

#import "MingxiListTableViewCell.h"

@implementation MingxiListTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (void)SQ_Style:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    UIView * bgView = [[UIView alloc]init];
    bgView.backgroundColor = UIColor.blackColor;
    [self.contentView addSubview:bgView];
    [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.centerY.equalTo(self.contentView);
        make.height.mas_equalTo(66);
    }];
    [bgView addSubview:self.nameLabel];
    [bgView addSubview:self.timeLabel];
    [bgView addSubview:self.numberLabel];
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(bgView).offset(20);
        make.top.equalTo(bgView).offset(12);
    }];
    [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(bgView).offset(20);
        make.top.equalTo(bgView).offset(36);
    }];
    [self.numberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(bgView.mas_right).offset(-20);
        make.centerY.equalTo(bgView);
    }];
}
- (void)setModel:(MingXiModel *)model{
    _model = model;
    self.nameLabel.text = model.remark;
    self.timeLabel.text = model.createTime;
    if (model.type) {
        self.numberLabel.text = [NSString stringWithFormat:@"+%@",model.num];
        self.numberLabel.textColor = UIColor.redColor;
    } else {
        self.numberLabel.text = [NSString stringWithFormat:@"-%@",model.num];
        self.numberLabel.textColor = UIColor.whiteColor;
    }
}

- (UILabel *)nameLabel{
    if (!_nameLabel) {
        _nameLabel = [[UILabel alloc]init];
        _nameLabel.font = FONT_MEDIUM(16);
        _nameLabel.textColor = UIColor.whiteColor;
        _nameLabel.backgroundColor = UIColor.clearColor;
        _nameLabel.numberOfLines = 0;
    }
    return _nameLabel;
}

- (UILabel *)numberLabel{
    if (!_numberLabel) {
        _numberLabel = [[UILabel alloc]init];
        _numberLabel.font = FONT_MEDIUM(16);
    }
    return _numberLabel;
}

- (UILabel *)timeLabel{
    if (!_timeLabel) {
        _timeLabel = [[UILabel alloc]init];
        _timeLabel.font = FONT_REGULAR(12);
        _timeLabel.textColor = SQColor999999;
        _timeLabel.backgroundColor = UIColor.clearColor;
    }
    return _timeLabel;
}

@end
